package com.wc.AlgoOJ_homework.ALOJ模块测试Ⅱ.A_画廊;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/5/16 13:05
 * @description http://43.138.190.70:8888/p/LQ1119?tid=663e2cd8d39d10926ed3fa74
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 510;
    static double INF = 1e50;
    // f[i][j][k] 表示到达左边到达第i个点，右边到达第j个点， k = 0表示在左边，k = 1表示在右边
    static double[][][] f = new double[N][N][2];
    static double[] a = new double[N], b = new double[N];
    static int n, m, d, w;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        d = sc.nextInt();
        w = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        for (int i = 1; i <= m; i++) b[i] = sc.nextInt();
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                Arrays.fill(f[i][j], INF);
            }
        }
        f[0][0][0] = f[0][0][1] = w / 2.0;
        f[0][1][1] = getDistance(b[1], w / 2.0);
        f[0][1][0] = f[0][1][1] + getDistance(b[1], w);
        f[1][0][0] = getDistance(a[1], w / 2.0);
        f[1][0][1] = f[1][0][0] + getDistance(a[1], w);

        for (int i = 2; i <= n; i++) {
            f[i][0][0] = f[i - 1][0][0] + a[i] - a[i - 1];
            f[i][0][1] = f[i][0][0] + getDistance(a[i], w);
        }
        for (int i = 2; i <= m; i++) {
            f[0][i][1] = f[0][i - 1][1] + b[i] - b[i - 1];
            f[0][i][0] = f[0][i][1] + getDistance(b[i], w);
        }

        // init
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                f[i][j][0] = Math.min(f[i - 1][j][0] + a[i] - a[i - 1],
                        f[i - 1][j][1] + getDistance(a[i] - b[j], w));
                f[i][j][1] = Math.min(f[i][j - 1][1] + b[j] - b[j - 1],
                        f[i][j - 1][0] + getDistance(a[i] - b[j], w));
            }
        }
        double res = Math.min(f[n][m][0] + getDistance(d - a[n], w / 2.0),
                f[n][m][1] + getDistance(d - b[m], w / 2.0));
        out.printf("%.2f\n", res);
        out.flush();
    }

    static double getDistance(double dx, double dy) {
        return Math.sqrt(dx * dx + dy * dy);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
